// pages/collect/index.js
Page({

  data: {
    tabs: [{
        id: 0,
        value: "商品收藏",
        isActive: true
      },
      {
        id: 1,
        value: "品牌收藏",
        isActive: false
      },
      {
        id: 2,
        value: "店铺收藏",
        isActive: false
      },
      {
        id: 3,
        value: "浏览足迹",
        isActive: false
      }
    ],
    collect:[]
  },
  onLoad(){

  },
  onShow(){
    const collect=wx.getStorageSync("collect")||[];
    this.setData({
      collect
    })
  },
  //标题的点击事件
  handletabsItemChange(e) {
    //获取被点击的标题索引
    const {
      index
    } = e.detail;
    //修改原数组
    let {
      tabs
    } = this.data;
    tabs.forEach((e, i) => {
      i === index ? e.isActive = true : e.isActive = false
    });
    this.setData({
      tabs
    })
  },

})